import { defHttp } from "@/utils/http";

export interface PostVO {
	id?: number;
	name: string;
	code: string;
	sort: number;
	status: number;
	remark: string;
	createTime?: Date;
}

// 查询岗位列表
export const getPostPage = async (params: PageParam) => {
	return await defHttp.get({ url: "/system/post/page", params });
};

// 获取岗位精简信息列表
export function getSimplePostList() {
	return defHttp.get({ url: "/system/post/simple-list" });
}

// 获取岗位精简信息列表
export function listSimplePosts() {
	return defHttp.get({ url: "/system/post/list-all-simple" });
}

// 查询岗位详情
export const getPost = async (id: number) => {
	return await defHttp.get({ url: "/system/post/get?id=" + id });
};

// 新增岗位
export const createPost = async (data: PostVO) => {
	return await defHttp.post({ url: "/system/post/create", data });
};

// 修改岗位
export const updatePost = async (data: PostVO) => {
	return await defHttp.put({ url: "/system/post/update", data });
};

// 删除岗位
export const deletePost = async (id: number) => {
	return await defHttp.delete({ url: "/system/post/delete?id=" + id });
};

// 导出岗位
export const exportPost = async (params: any) => {
	return await defHttp.download({ url: "/system/post/export", params });
};
